
const config = require("../config/env");
const Koa = require("koa");
const app = new Koa()

const loadMiddleware = (path, app) => {
  require(path)(app);
}

const loadRouters = (path, app) => {
  require(path)(app);
}

console.log(process.env.NODE_ENV);

loadMiddleware("./middleware/static_file", app);
loadMiddleware("./middleware/bodyparser", app);
loadMiddleware('./middleware/views', app);
loadRouters("./routers/proxy", app);
loadRouters("./routers/base", app);


app.listen(config.listen_port);
console.log(`${config.env} Serve running on http://127.0.0.1:${config.listen_port}`);